package com.woniuxy.house.service.serviceimpl;

import com.woniuxy.house.entity.Booking;
import com.woniuxy.house.mapper.BookingMapper;
import com.woniuxy.house.service.BookingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 预约看房表表serviceimpl
 */
@Service
public class BookingServiceImpl implements BookingService {

    @Autowired
    private BookingMapper bookingMapper;


    /**
     * 增加预约看房表
     */
    @Override
    public void addBooking(Booking booking) {
        bookingMapper.addBooking(booking);
    }

    /**
     * 增加预约看房表
     */
    @Override
    public void updateBooking(Booking booking) {
        bookingMapper.updateBooking(booking);
    }

    /**
     * 增加预约看房表
     */
    @Override
    public void deleteBooking(Integer id) {
        bookingMapper.deleteBooking(id);
    }

    /**
     * 查询全部的预约看房表
     */
    @Override
    public List<Booking> getAll() {
        List<Booking> bookings=bookingMapper.getAll();
        return bookings;
    }

    /**
     * 根据用户id查询的预约看房表
     */
    @Override
    public List<Booking> getByUserId(Integer userId) {
        return bookingMapper.getByUserId(userId);
    }

    /**
     * 根据房源id查询的预约看房表
     */
    @Override
    public List<Booking> getBySourceId(Integer sourceId) {
        return bookingMapper.getBySourceId(sourceId);
    }
}
